package cn.tedu.store.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092300575178";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCXmsywNWys8wq8QfNnzPAKxArLcyEIi1A8NxzrvdD8D6RbyBgCsqZVrFY37DBsXyHfXO7+GX5pVlLFmEbObpPZAgQd5IAN5zjv4vmzcK1rXe4i+/QJ6OXxZRsvbbuYtrcBk8qGzy/7By4zOPa49Y0dQksdc/jEem2yb5savnGjjOqeG8Wec2Omm4bW3ghiJGUEXoBxTUY01WiwKyc5KHpDt9FbiD9O0vDwG8wPV45R2R1buyNnC3shPnwwV79vPkDaHdR4sOYn8BADKHG0gFwRGxcws0wLismjnEiMcAxLoVnFpQstw/d7aBNSoJi7St1/pdNqzjey/eQjsMaOhjwLAgMBAAECggEAGI2TlP4yCZibJn4v46HHRpcVgHm24eFeL0JlxrBJRmlqHws7CETSt5FfrVLtTL/jhn9QnYqXdIvsf9/3p7s06rJu5EB7lMTb7c3+ztby3y6pQLU5gtlbVEshqf7FoSgGX5UF+etYQ/mXu+f/3Vi3cAOqkqyTn46McZetsRki4m/SN9ALzrhyFmg0bfrFKp8UhnRlfQACwo50VmjMmD9WRoO+w+i5MsR5IOSuQJ9VwpNJn4FF8FHUX1YPMyv+nCvmU9jxp3X2NWuAtrFFj82LMYK1gOfR4i+yHCg1FpFrDAGBRssVdZGIvncvkWYaR097W8CPFv+A1LZ1Utmg4RSWEQKBgQDN39nUZTJdnWHT/TICqYz6ZN2YgevhurP5JaAfrOzM3RWmiTBuAS2I+JVcG8Q9iyYsLZLOnTuURKrPk1KqUhmzdhKPL1rjXLqL3V3bQxgjE7fuaCinO/soZlCZ4Ch4D9Hrr+qbZZJ8r3WGqVQ046Dt63pBlPfx6zv+V5G9QqCBPwKBgQC8hFEx2CT6SyjwlzgUD/47jcckZF6+w+fdskOQhNq0vJfo78fZIVK6eC5TpwgK7fCJmATLB6i3OPFKqQCaAYnKzdkRFT993UHQT5081rqW4lP88bR+2OGUUK4Cilsf8f4X+Pg5QdN0t/qCCOoWoJTjS+lRfwrO3jSPFPAbarwGNQKBgQCDwerwQt/MCAhvGtFh4M9IBTvI+gVTzyCVqJ3lB8/5gNj1X0GudXSF/8nfTCn41VBV38jgEMLrrlK/TGMQfEDUmRFhsAX0EwmUr9T8meEdueXyX5j9BqdEAM8+27YquL05oLl+QLBSuhx2VXJ98tywyA7TYBqbKliX+8VbIgQFEwKBgQCbyn2PQ6DLd/GNYmrlqZHghXpdiNUDscKcZAWSGTjkxDaGOiJePjuv/kHKv+7VmW1/SDIt11aGlHhTyvbETyEgiJ0qkPS3f3I0RJcdABeTOddO4jDX40QI3ePwFYbZD5N9HDOGne+yNZjAfb12lZ51ePaIcwTrkJa+5/7FqZ9ZQQKBgGlVxARPlSW5gaY9pmX0zKxt+LB8yc0NZcGGsFUik8mBGrui3hFuVbwDXDGKLTe0wfdcmnauDFpnI4CVHXYKAXdlz2oxy41rAc8mvEws7wHcX84JAxTpviUEEfJYBTPV60xF7L67Hv1F4wtIltuLRlzijNOqiARiTptBFdQ3nGlf";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5rMsDVsrPMKvEHzZ8zwCsQKy3MhCItQPDcc673Q/A+kW8gYArKmVaxWN+wwbF8h31zu/hl+aVZSxZhGzm6T2QIEHeSADec47+L5s3Cta13uIvv0Cejl8WUbL227mLa3AZPKhs8v+wcuMzj2uPWNHUJLHXP4xHptsm+bGr5xo4zqnhvFnnNjppuG1t4IYiRlBF6AcU1GNNVosCsnOSh6Q7fRW4g/TtLw8BvMD1eOUdkdW7sjZwt7IT58MFe/bz5A2h3UeLDmJ/AQAyhxtIBcERsXMLNMC4rJo5xIjHAMS6FZxaULLcP3e2gTUqCYu0rdf6XTas43sv3kI7DGjoY8CwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/web/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/web/paySuccess.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "F:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

